var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var i in t) t.hasOwnProperty(i) && (e[i] = t[i]);
    })(e, t);
}, function(e, t) {
    function i() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, 
    new i());
}), a = this && this.__decorate || function(e, t, i, a) {
    var r, n = arguments.length, o = n < 3 ? t : null === a ? a = Object.getOwnPropertyDescriptor(t, i) : a;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(e, t, i, a); else for (var d = e.length - 1; 0 <= d; d--) (r = e[d]) && (o = (n < 3 ? r(o) : 3 < n ? r(t, i, o) : r(t, i)) || o);
    return 3 < n && o && Object.defineProperty(t, i, o), o;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("GameConfig"), s = e("GameData"), c = e("LoadManager"), l = e("Global"), d = cc._decorator, u = d.ccclass, p = d.property, h = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.checkMark = null, e.sprite = null, e.shadowSprite = null, e.nameLabel = null, 
        e.descLabel = null, e;
    }
    return i(e, t), e.prototype.start = function() {}, e.prototype.init = function(t) {
        switch (t.type) {
          case l.RewardType.SKIN:
            var e;
            t.data && !isNaN(t.data.idx) && 0 < (i = l.G.personModelList.filter(function(e) {
                return e.id == t.data.idx;
            })).length && (-1 < s.GD.skins.indexOf(i[0].id) && -1 < r.GC.personExpectList.indexOf(i[0].id) ? 0 < (e = this.getRealSkin()).length ? (t.data.idx = e[0].id, 
            this.nameLabel.string = e[0].m, this.loadSpriteFrame("image/draw/彩蛋墙" + e[0].m + "@2x", .6, .7)) : (this.nameLabel.string = i[0].m, 
            this.loadSpriteFrame("image/draw/彩蛋墙" + i[0].m + "@2x", .6, .7)) : (t.data.idx = i[0].id, 
            this.nameLabel.string = i[0].m, this.loadSpriteFrame("image/draw/彩蛋墙" + i[0].m + "@2x", .6, .7)));
            break;

          case l.RewardType.ARM:
            var i;
            t.data && !isNaN(t.data.idx) && (3e3 <= t.data.idx ? 0 < (i = l.G.olympicGunModelList.filter(function(e) {
                return e.id == t.data.idx;
            })).length && (this.nameLabel.string = i[0].m, this.loadSpriteFrame("texture/armOlympic/" + i[0].id, .8, 1)) : 2e3 <= t.data.idx ? 0 < (i = l.G.drawGunModelList.filter(function(e) {
                return e.id == t.data.idx - 2e3;
            })).length && (this.nameLabel.string = i[0].m, this.loadSpriteFrame("image/arm_draw/" + i[0].id, .8, 1)) : 1e3 <= t.data.idx ? 0 < (i = l.G.eggGunModelList.filter(function(e) {
                return e.id == t.data.idx - 1e3;
            })).length && (this.nameLabel.string = i[0].m, this.loadSpriteFrame("image/arm3/" + i[0].id, .8, 1)) : 0 < (i = l.G.gunModelList.filter(function(e) {
                return e.id == t.data.idx;
            })).length && (this.nameLabel.string = i[0].m + "(试用)", this.loadSpriteFrame("image/arm/" + i[0].id, .8, 1)));
            break;

          case l.RewardType.ELF:
            this.nameLabel.string = "小精灵", this.loadSpriteFrame("image/draw/小精灵big", 1, 1.3);
            break;

          case l.RewardType.STONE:
            this.nameLabel.string = "进化石", this.descLabel.string = "(小精灵进化材料)", this.loadSpriteFrame("image/draw/进化石big", 1, 1.3);
        }
    }, e.prototype.refresh = function(e) {
        this.init(e);
    }, e.prototype.getRealSkin = function() {
        return l.G.personModelList.filter(function(e) {
            return 100 <= e.id && s.GD.skins.indexOf(e.id) < 0 && r.GC.personExpectList.indexOf(e.id) < 0;
        });
    }, e.prototype.loadSpriteFrame = function(e, t, i) {
        var a = this;
        c.default.getInstance().loadRes({
            url: e,
            type: cc.SpriteFrame
        }).then(function(e) {
            a.sprite.node.scale = t, a.shadowSprite.node.scale = i, a.sprite.spriteFrame = e, 
            a.shadowSprite.spriteFrame = e;
        });
    }, a([ p(cc.Node) ], e.prototype, "checkMark", void 0), a([ p(cc.Sprite) ], e.prototype, "sprite", void 0), 
    a([ p(cc.Sprite) ], e.prototype, "shadowSprite", void 0), a([ p(cc.Label) ], e.prototype, "nameLabel", void 0), 
    a([ p(cc.Label) ], e.prototype, "descLabel", void 0), a([ u ], e);
}(cc.Component);

n.default = h;